<script type="text/javascript" src="<?php echo base_url()?>js/jquery.popupWindow.js"></script>
<?php foreach($rs1 as $r)?>
<p>&nbsp;</p>
<div align="center">
  <h1>ตารางกรอกข้อมูลคุณภาพสินค้า Folio Sheet</h1>
</div>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="62%" valign="top"><strong>Data Detail<br />
      <br />
      </strong>
      <table width="90%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#94c0d2">
        <tr>
          <td width="12%" height="32" bgcolor="#DAECF4">&nbsp;Type</td>
          <td width="17%" align="center"><?php echo $r['type_of']; ?></td>
          <td width="18%" bgcolor="#DAECF4">&nbsp;Size</td>
          <td width="12%" align="center"><?php echo $r['size']; ?></td>
          <td width="14%" bgcolor="#DAECF4">&nbsp;Date</td>
          <td width="27%" align="center"><?php echo $r['modify_date']; ?></td>
        </tr>
        <tr>
          <td height="30" bgcolor="#DAECF4">&nbsp;Gram</td>
          <td align="center"><?php echo $r['gram']; ?></td>
          <td bgcolor="#DAECF4">&nbsp;Lot No.</td>
          <td align="center"><?php echo $r['lot_no']; ?></td>
          <td bgcolor="#DAECF4">&nbsp;Shift</td>
          <td align="center"><?php echo $r['shift']; ?></td>
        </tr>
        <tr>
          <td height="30" bgcolor="#DAECF4">&nbsp;Grade</td>
          <td align="center"><?php echo $r['grade']; ?></td>
          <td bgcolor="#DAECF4">&nbsp;Position</td>
          <td align="center"><?php echo $r['position']; ?></td>
          <td bgcolor="#DAECF4">&nbsp;Sorter</td>
          <td align="center"><?php echo $r['sorter']; ?></td>
        </tr>
        <tr>
          <td height="30" colspan="6" align="center"><table width="99%" align="center">
            <tr>
              <td width="77%" align="center"><?php if($r["status"] == 1)
    { echo "<h2>Status :: <font color=green>ผ่านการทดสอบ</font></h2>";} 
    else 
    {
    	echo "<h2>Status :: <font color=red>ไม่ผ่านการทดสอบ</font></h2>";
      
     } 
    ?></td>
              <td width="23%" align="center"><a href="<?php echo base_url();?>index.php/comment/Addcomment/<?php echo $r['t_id']; ?>" class="example1demo"><img src="<?php echo base_url();?>css/comment.png" width="50" height="41" /></a><br />
                เขียนคอมเมนต์
                <script type="text/javascript"> 
				$('.example1demo').popupWindow({ 
				height:600, 
				width:500, 
				top:100, 
				left:400 
				}); 
				</script></td>
            </tr>
          </table></td>
        </tr>
      </table></td>
    <td width="38%" valign="top"><strong>Work Flow<br />
      <br />
      </strong>
      <table width="98%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#94c0d2">
        <tr>
          <td width="14%" align="center" height="32" bgcolor="#DAECF4">flow no</td>
          <td width="31%" align="center" bgcolor="#DAECF4">Approve By</td>
          <td width="20%" align="center" bgcolor="#DAECF4">Start Time</td>
          <td width="20%" align="center" bgcolor="#DAECF4">End Time</td>
          <td width="30%" align="center" bgcolor="#DAECF4">Flow Status</td>
        </tr>
        <?php 
  $run = 1;
  foreach($instance_flow as $r)
	{
  echo "<tr>";
  echo "<td height='30' align = 'center'>".$run."</td>";
  echo "<td>".$r['user_approve']."</td>";
  echo "<td>".$r['startTime']."</td>";
  echo "<td>".$r['endTime']."</td>";
  echo "<td align='center'>".$r['status']."</td>";
  echo "</tr>";
  $run++;
  }
  ?>
      </table></td>
  </tr>
</table>
<p>&nbsp;</p>
<table width="99%" align="center" class="font">
  <tr>
    <td><table id="grid">
        <thead>
          <tr>
            <th data-field="rank">Properties Item</th>
            <th data-field="rating">Value</th>
            <th data-field="title">Unit</th>
            <th data-field="year">Properties Item</th>
            <th data-field="dse">Value</th>
            <th data-field="asa">Unit</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>พื้นที่สกปรก ( Dirt )</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS12')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>ppm.</td>
            <td><strong>ฉลากสินค้า/คุณภาพการหีบห่อ</strong></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>จำนวนแผ่นสกปรก /45 แผ่น</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS13')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>แผ่น</td>
            <td>แกรม</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS22')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>1 = ถูกต้อง,   2= ไม่ถูกต้อง</td>
          </tr>
          <tr>
            <td>ลักษณะขุยกระดาษ</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS14')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>No.</td>
            <td>ขนาด</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS23')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>1 = ถูกต้อง,   2= ไม่ถูกต้อง</td>
          </tr>
          <tr>
            <td>การวางแนวเกรนกระดาษ</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS15')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>1=Long grain,2=Shot grain</td>
            <td>Mat no.</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS24')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>1 = ถูกต้อง,   2= ไม่ถูกต้อง</td>
          </tr>
          <tr>
            <td>จำนวนแผ่น (500 แผ่น)</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS16')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>แผ่น</td>
            <td>Lot no.</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS25')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>1 = ถูกต้อง,   2= ไม่ถูกต้อง</td>
          </tr>
          <tr>
            <td>ขนาดแผ่นกระดาษ</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS17')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>mm.</td>
            <td>จำนวนรีม</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS26')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>รีม</td>
          </tr>
          <tr>
            <td>ฉากกระดาษ ด้านกว้าง</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS18')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>mm.</td>
            <td>ความสูงตั้ง</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS27')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>cm.</td>
          </tr>
          <tr>
            <td>ฉากกระดาษ ด้านยาว</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS19')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>mm.</td>
            <td>สภาพตั้ง/ห่อรีม</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS28')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>1.ผ่าน, 2.ไม่ผ่าน</td>
          </tr>
          <tr>
            <td>รอยหยักฟันปลา</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS20')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>mm.</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>เฉดสีกระดาษ</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']== 'foliosheetFS21')
				  {
				  	if($r['status']== '1')
						{
							echo $r['data_value'];
						}
					else
						{
			echo "<span class='red'>"."<strong>".$r['data_value']."</strong>"."</span>";
						}
				  }
			  }
			  ?></td>
            <td>1 = ไม่ต่าง,2= แตกต่าง</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><strong>ปัญหาที่พบตามลักษณะ</strong></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </tbody>
      </table>
    <script>
                $(document).ready(function() {
                    $("#grid").kendoGrid({
						columns: [
						{ field: "rank", width: "40px" },
						{ field: "rating", width: "10px" },
						{ field: "title",  width: "20px" },
						{ field: "year", width: "40px" },
						{ field: "dse", width: "10px" },
						{ field: "asa", width: "20px" }
						],
                        //height: 1000,
						//pageable: true,
						dataSource: {
						//pageSize: 12
						} 
                    });
                });
            </script></td>
  </tr>
</table>

<!--scrip list select--> 
<script>
                $(document).ready(function() {
                    var viewModel = {
                        chosenTicket: ko.observable(),
                        resetTicket: function() { this.chosenTicket(null) },
                    };
                    $("#ticket1").kendoDropDownList().trigger("change");
                    $("#ticket2").kendoDropDownList().trigger("change");
                    $("#ticket3").kendoDropDownList().trigger("change");
                    $("#ticket4").kendoDropDownList().trigger("change");
                    $("#ticket5").kendoDropDownList().trigger("change");
                    $("#ticket6").kendoDropDownList().trigger("change");
                    $("#ticket7").kendoDropDownList().trigger("change");
                });
      		</script> 
<!--scrip วัน-เดือน-ปี--> 
<script>
                $(document).ready(function() {
                    var today = new Date(),
                        birthdays = [
                           +new Date(today.getFullYear(), today.getMonth(), 11),
                           +new Date(today.getFullYear(), today.getMonth() + 1, 6),
                           +new Date(today.getFullYear(), today.getMonth() + 1, 27),
                           +new Date(today.getFullYear(), today.getMonth() - 1, 3),
                           +new Date(today.getFullYear(), today.getMonth() - 2, 22)
                        ];

                    $("#datepicker").kendoDatePicker({
                        value: today,
                        month: {
                            // template for dates in month view
                            content: '# if ($.inArray(+data.date, [' + birthdays + ']) != -1) { #' +
                                         '<div class="birthday"></div>' +
                                     '# } #' +
                                     '#= data.value #'
                        },
                        footer: "Today - #=kendo.toString(data, 'd') #"
                    });

                    $("#datepicker").data("kendoDatePicker")
                                    .dateView.calendar.element
                                    .width(300);
                });
            </script> 
<!--scrip เวลา--> 
<script>
                $(document).ready(function() {
                    // create TimePicker from input HTML element
                    $("#timepicker").kendoTimePicker();
                });
            </script>